enum Type{FIELD_INT,
        FIELD_STRING,
        FIELD_DOUBLE,
        FIELD_ID};

typedef struct Data{
    union{
        double d;
        int i;
        char * m_string;
    } value;
    enum Type type;
}DataStruct,* DataStructPoint;

// create

typedef struct CreateField{
    char * name;
    enum Type type;
    int  length;
    struct CreateField * next;
}CreateFieldsStruct,* CreateFieldStructPoint;

typedef struct Create{
    char * name;
    CreateFieldStructPoint fields;
}CreateStruct,*CreateStructPoint;


enum CMP{
    GT,GE,EQ,LT,LE,NE,AND_CMP,OR_CMP,NO_CMP
};

typedef struct TableList{
    char name[128];
    struct TableList * next;
}TableListStruct,*TableListStructPoint;

// select

typedef struct Condition{
    struct Condition * left;
    struct Condition * right;
    enum CMP cp;
    enum Type type;
    DataStructPoint value;
    char * table;
 } ConditionStruct,* ConditionStructPoint;

typedef struct SelectedField{
    char * table;
    char * field;
    char * alias;
    int offset;
    struct SelectedField * next;
}SelectedFieldStruct,*SelectedFieldStructPoint;

typedef struct SelectedTable{
    char * table;
    struct SelectedTable * next;
}SelectedTableStruct,*SelectedTableStructPoint;

typedef struct Select{
    SelectedFieldStructPoint   fp;
    SelectedTableStructPoint   tp;
    ConditionStructPoint       cp;
}SelectStruct,* SelectStructPoint;


// update
typedef struct UpdatedField{
    char * name;
    DataStructPoint value;
    struct UpdatedField * next;
}UpdatedFieldStruct,*UpdatedFieldStructPoint;

typedef struct Update{
    char * table;
    UpdatedFieldStructPoint fp;
    ConditionStructPoint cp;
}UpdateStruct,* UpdateStructPoint;


// delete
typedef struct Delete{
    char * table;
    ConditionStructPoint cp;
} DeleteStruct,*DeleteStructPoint;

typedef struct InsertItem{
    DataStructPoint  value;
    struct InsertItem * next;
}InsertItemStruct, * InsertItemStructPoint;

typedef struct InsertField{
    char * fieldName;
    struct InsertField * next;
} InsertFieldStruct, * InsertFieldStructPoint;

typedef struct Insert{
    char * table;
    InsertFieldStructPoint fields;
    InsertItemStructPoint items;
}InsertStruct,* InsertStructPoint;

